package com.fita.wechat.dao;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.fita.entity.user.User;
import com.fita.entity.user.WechatAccount;

/**
 * 
 * @author mohanlan
 *
 */
@Dao("hibernate")
public interface UserDao {
    
    /**
     * load user by unionid
     * 
     * @param unionid
     * @return
     */
    @Query("FROM User WHERE unionid = :unionid AND disabled = false")
    public User loadUser(@Variable("unionid") String unionid);

    /**
     * 
     * @param unionid
     * @return
     */
    @Query("FROM User WHERE unionid = :unionid AND disabled = false")
    public User getUserByUnionid(@Variable("unionid") String unionid);
    
    /**
     * load wechatAccount by unionid
     * 
     * @param unionid
     * @return
     */
    @Query("FROM WechatAccount WHERE unionid = :unionid")
    public WechatAccount loadAccount(@Variable("unionid") String unionid);
}
